
using System;
using System.Drawing;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using bjeschool_csharp.Model;

namespace bjeschool
{
	public partial class HomeWorkCommitCell : CommonCell<M_HomeWorkCommit>
	{
		[Outlet("FolderView")]
		private UIView FolderView { get; set; }

		[Outlet("TeacherView")]
		private UIView TeacherView { get; set; }

		[Outlet("FolderBtn")]
		private UIButton FolderBtn { get; set; }

		[Action("OnFolderClick:")]
		private void OnFolderClick(UIButton sender)
		{
			RowsState rs = tableView.GetRowState(indexPath);
			rs.collaps = !rs.collaps;
			rs.height = rs.collaps?50:550;
			tableView.SetRowState(indexPath, rs);
		}

		public HomeWorkCommitCell ()// : base ("HomeWorkCommitCell", null)
		{
			NSBundle.MainBundle.LoadNib("HomeWorkCommitCell", this, null);
		}
		
		public override void SetData (M_HomeWorkCommit item)
		{			
			CommitTime.Text = item.CommitTime.ToString();
			CommitTitle.Text = item.CommitTitle;
			CommitContent.Text = item.CommitContent;

			Result.Text = item.Result;
			Sheet.Text = item.Sheet.ToString();
			Grade.Text = item.Grade;

			RowsState rs = tableView.GetRowState(indexPath);
			FolderView.Hidden = rs.collaps;
			FolderBtn.Selected = rs.collaps;
		}

		[Outlet("CellView")]
		public override UITableViewCell CellView { get; set; }
		[Outlet("CommitTitle")]
		public UILabel CommitTitle {get;set;}
		[Outlet("CommitTime")]
		public UILabel CommitTime {get;set;}
		[Outlet("CommitContent")]
		public UITextView CommitContent {get;set;}

		[Outlet("Result")]
		public UITextView Result {get;set;}
		[Outlet("Sheet")]
		public UITextField Sheet {get;set;}
		[Outlet("Grade")]
		public UITextField Grade {get;set;}
	}
}

